/**
 * Copyright (c) 2010-2011 Pierre Labatut
 *
 * This file is part of Space-Chronicles project.
 *
 * Space-Chronicles is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/space-chronicles/>.
 */
package space.app.meshview.state;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import jinngine.math.Quaternion;

/**
 *
 * @author Pierre
 */
public class ViewPointStateMachine implements MouseListener, MouseMotionListener, MouseWheelListener {

    AbstractState state;

    public ViewPointStateMachine(final MeshCamera camera, final Quaternion lightDirection) {
        if (camera== null) {
            throw new IllegalArgumentException();
        }
        if (lightDirection == null) {
            throw new IllegalArgumentException();
        }
        state = new DefaultState(camera, lightDirection);
    }

    public void mouseClicked(MouseEvent e) {
        state = state.mouseClicked(e);
    }

    public void mousePressed(MouseEvent e) {
        state = state.mousePressed(e);
    }

    public void mouseEntered(MouseEvent e) {
        state = state.mouseEntered(e);
    }

    public void mouseExited(MouseEvent e) {
        state = state.mouseExited(e);
    }

    public void mouseMoved(MouseEvent e) {
        state = state.mouseMoved(e);
    }

    public void mouseReleased(MouseEvent e) {
        state = state.mouseReleased(e);
    }

    public void mouseDragged(MouseEvent e) {
        state = state.mouseDragged(e);
    }

    public void mouseWheelMoved(MouseWheelEvent e) {
        state = state.mouseWheelMoved(e);
    }
}
